package display;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.springframework.web.context.*;

import domain.PaisRepository;
import domain.Pais;

import util.PaisDTO;
import util.PaisAssembler;

public class DetallePais extends PageController {
  
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response)
    throws ServletException, IOException {
	  PaisRepository paises =
		  (PaisRepository) context.getBean("PaisRepository");
    try {
			String id = request.getParameter("id");
			int idProf = Integer.parseInt(id); 
			Pais prof = paises.findPais(idProf);
			PaisDTO dto = PaisAssembler.CreateDTO(prof);
      request.setAttribute("pais",dto);
      forward("/detallePais.jsp",request,response);
		} catch (Exception e) {
			request.setAttribute("mensaje",e.getMessage());
			forward("/paginaError.jsp",request,response);
		}
  }
}